package com.ygsoft.tianlu_mall.service.impl;

import com.ygsoft.tianlu_mall.mapper.GoodsMapper;
import com.ygsoft.tianlu_mall.pojo.Goods;
import com.ygsoft.tianlu_mall.pojo.Property;
import com.ygsoft.tianlu_mall.pojo.PropertyValue;
import com.ygsoft.tianlu_mall.pojo.Type;
import com.ygsoft.tianlu_mall.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    GoodsMapper goodsMapper;


    @Override
    public List<Map<String, Object>> getToalTypeName() {
        return goodsMapper.getToalTypeName();
    }

    @Override
    public List<Map<String, Object>> getAllPropertyByTypeId(int type_id) {
        return goodsMapper.getAllPropertyByTypeId(type_id);
    }

    @Override
    public List<Map<String, Object>> getPropertyValueById(int goods_id) {
        return goodsMapper.getPropertyValueById(goods_id);
    }

    @Override
    public List<Map<String, Object>> getGoodsDetailByGoodsId(int goods_id) {
        return goodsMapper.getGoodsDetailByGoodsId(goods_id);
    }

    @Override
    public HashMap<String, Object> checkIsCollect(Integer user_id, int goods_id) {
        HashMap<String,Object> map = new HashMap<>();
        map.put("user_id",user_id);
        map.put("goods_id",goods_id);
        return goodsMapper.checkIsCollect(map);
    }

    @Override
    public List<Map<String, Object>> getGoodsIndex() {
        return goodsMapper.getGoodsIndex();
    }

    @Override
    public List getGoodsIdByTypeId(int type_id) {
        return goodsMapper.getGoodsIdByTypeId(type_id);
    }

    @Override
    public List<Map<String, Object>> getGoodsByTypeId(int type_id) {
        return goodsMapper.getGoodsByTypeId(type_id);
    }

    @Override
    public List<Integer> getGoodsId() {
        return goodsMapper.getGoodsId();
    }

    @Override
    public Map<String,Object> getRecommendGoodsId(int type_id) {
        return goodsMapper.getRecommendGoodsId(type_id);
    }

    @Override
    public List<Map<String, Object>> getRecommendGoodsByType(int goods_id) {
        return goodsMapper.getRecommendGoodsByType(goods_id);
    }

    @Override
    public int getRecommendGoodsId2(int type_id) {
        return goodsMapper.getRecommendGoodsId2(type_id);
    }
}
